<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>内置指令</title>
  <!-- 开发环境版本，包含了有帮助的命令行警告 -->
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="demo">
  <p ref="content">ywh</p>
  <button @click="hint">提示</button>
  <p>{{msg}}</p>
</div>
<script type="text/javascript">
  const vm = new Vue({
    el: '#demo',
    data:{
      msg:'macpro'
    },
    methods:{
      hint(){
        alert(this.$refs.content.textContent)
      }
    }
  });
</script>
</body>
</html>